
Type SceneNode Extends BaseObject
	Global _list:TList
	
rem
bbdoc: Creates a new named SceneNode as a child of this node. 
about: <p>This creates a child node with a given name, which allows you to look the node up from the parent 
which holds this collection of nodes.</p>
<p><b>Parameters:</b></p>
<table cellpadding="4" cellspacing="4" border="0">
<tr>
	<td><i>translate</i></td><td>Initial translation offset of child relative to parent</td>
</tr>
<tr>
    <td><i>rotate</i></td><td>Initial rotation relative to parent</td>
</tr>
</table>
endrem
	Method createChildSceneNode:SceneNode(entityName:String = "", translate:bVector3 = Null, rotate:bQuaternion = Null)
		Local csn:SceneNode = New SceneNode
		
		Local v:Byte ptr = Null
		Local q:Byte ptr = Null
		
		If translate <> Null Then v = translate.toC()
		If rotate <> Null Then q = rotate.toC()
		
		If Not entityName.Length Then entityName = Root.genName("scenenode_")
		
		csn._ptr = o_createChildSceneNode(Self._ptr, entityName.ToCString(), v, q)
		csn._typ = ET_SCENENODE
		
		Return csn
	End Method
	
rem
bbdoc: Adds an instance of a scene object to this node. 
endrem
	Method attachObject(obj:BaseObject)
		o_attachObject(Self._ptr, obj._ptr)
	End Method
	
rem
bbdoc: Rotate the node around the X-axis. 
endrem	
	Method pitch(angle:Float, relativeTo:Int = TS_PARENT)
		o_scenenode_pitch(Self._ptr, angle, relativeTo)
	End Method

rem
bbdoc: Rotate the node around the Y-axis. 
endrem	
	Method yaw(angle:Float, relativeTo:Int = TS_PARENT)
		o_scenenode_yaw(Self._ptr, angle, relativeTo)
	End Method
	
rem
bbdoc: Rotate the node around the Z-axis. 
endrem
	Method roll(angle:Float, relativeTo:Int = TS_PARENT)
		o_scenenode_roll(Self._ptr, angle, relativeTo)
	End Method
	
rem
bbdoc: Moves the node along the Cartesian axes.<br>
This method moves the node by the supplied vector along the world Cartesian axes, i.e. along world x,y,z 
about: <p><b>Parameters:</b></p>
<table cellpadding="4" cellspacing="4" border="0">
<tr><td><i>x, y, z</i></td><td>Real x, y and z values representing the translation.</td></tr>
<tr><td><i>relativeTo</i></td><td>The space which this transform is relative to.</td></tr>
</table>
endrem
	Method translate(x:Float, y:Float, z:Float, relativeTo:Int = TS_PARENT)
		o_scenenode_translate(Self._ptr, x, y, z, relativeTo)
	End Method
	
rem
bbdoc: Sets the position of the node relative to it's parent. 
endrem
	Method SetPosition(x:Float, y:Float, z:Float)
		o_scenenode_setposition(self._ptr, x, y, z)
	End Method
	
rem
bbdoc: Gets the position of the node relative to it's parent. 
endrem
	Method GetPosition:bVector3()
		Local vec:bVector3 = bVector3.NullVec()
		Local vecp:Byte ptr = o_scenenode_getposition(Self._ptr)
		vec.x = Float ptr(vecp)[0]
		vec.y = Float ptr(vecp)[1]
		vec.z = Float ptr(vecp)[2]
		
		Return vec
	End Method
	
End Type